<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <input type="button" value="-" @click="remove">
    <span v-text="count"></span>
    <input type="button" value="+" @click="add()">
</div>
<script>
    var app=new Vue({
        el:"#app",
        data:{
            count:0
        },
        methods:{
              add:function () {
                if (this.count==10){
                    alert("不能再加了")
                }else {
                    this.count++;
                }

            },
            remove:function () {
                if (this.count==0){
                    alert("不能再减了")
                }else {
                    this.count--
                }

            }
        }
    })
</script>
</body>
</html>